// Created by zyq on 2025/3/26.
#include "iostream"

using namespace std;

class Person {

private:
    string name;

public:
    Person(string name) {
        this->name = name;
    }

    Person() {}

    virtual void Show() {
        cout << "Person::show()" << name << endl;
    }
};

class Finery : public Person {
protected:
    Person *component;
public:
    void Decorate(Person *component) {
        this->component = component;
    }

    void Show() override {
        if (component != nullptr) {
            component->Show();
        }
    }
};

class TShirts : public Finery {
public:
    void Show() override {
        cout << "大T恤" << endl;
        component->Show();
    }
};

class BigTrouser : public Finery {
public:
    void Show() override {
        cout << "垮裤" << endl;
        component->Show();
    }
};

int main() {
    Person *p = new Person("小明");
    cout << "第一种装扮" << endl;

    TShirts *t = new TShirts();
    BigTrouser *b = new BigTrouser();
    t->Decorate(p);
    b->Decorate(t);
    b->Show();

}